#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second

typedef long long ll;
typedef pair<int, int> pii;

const int N = 2010;
const int M = 1e9 + 7;

int n, fi, se;
pii p[N];

map<int, vector<pii>> m1;
map<pii, int> map_cnt;

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);

    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        cin >> fi >> se;
        p[i] = {fi, se};
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (p[i].y == p[j].y)
            {
                int x1 = p[i].x, x2 = p[j].x;
                if (x1 > x2)
                    swap(x1, x2);
                m1[p[i].y].push_back(make_pair(x1, x2));
                map_cnt[{x1, x2}]++;
            }
        }
    }

    ll res = 0;
    for (auto [_, v] : map_cnt)
    {
        if (v >= 2)
            res += v * (v - 1) / 2;
    }

    cout << res << endl;

    return 0;
}